<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>中奖记录</title>
	<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_474420_0o6wv3e9gbbuik9.css">
	<link rel="stylesheet" type="text/css" href="css/swiper.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/fontSize.js"></script>
	<script type="text/javascript" src="js/layer/layer.js"></script>
	<script type="text/javascript" src="js/zepto.min.js"></script>
	<script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/jweixin-1.2.0.js"></script>
	<script type="text/javascript" src="js/config.js"></script>
</head>
<body class="bgcolor win_record">
<div id="app">
	<div class="emptyAdress" v-if="list.length==0">暂没有中奖记录哟</div>
   	<!-- <div class="win_time"> <i class="iconfont icon-quan1"></i>2017.11.10</div> -->
	<ul class="shopList" v-for="item in list">
		<li class="borderBottom">
			<div class="shopList_top">
				<div class="shop_left">
				  <span><img :src="item.good.url" alt=""></span>
			    </div>
			    <div class="shop_right">
			    	<div class="shop_name">{{item.good.name}}</div>
			    	<div class="shop_price"><sub>￥</sub>{{item.coupon.price}}</div>
			    	<div class="shop_time"><span class="fl">原价<del>￥{{item.good.price}}元</del></span><span class="fr">截止：{{item.str}}</span></div>
			    </div>
			</div>
			<div class="shopList_bottom">
				<div class="shop_buttton" :style="'background-image:url('+item.coupon.url+')'">
					{{item.coupon.desc}}
				</div>
			</div>	
			<ul class="buy_tab borderTop">
				<li></li>
				<li @click="goBuy(item.good.id)">折扣购买</li>
			</ul>
		</li>
	</ul>
</div>
<script type="text/javascript">
	 var app = new Vue({
			el: '#app',
			data: {
			    list:[],
		        unionid:GetQueryString("unionid"),
		        // token:GetQueryString("token"),
		        token:"7e4e71d231ae6d50d5badbe9fbabc329",
		       
			},
			mounted(){
			  this.getList();
			},
			methods:{
				goBuy(id){
				   window.location.href="shopDetail.html?token="+this.token+"&unionid="+this.unionid+"&id="+id;
                   
				},
				getfinish_time(time){
                    var data=new Date(time*1000);
                    var y = data.getFullYear();
					var m = data.getMonth()+1;
                    var d = data.getDate();
                    return y+"."+m+"."+d;
				},
				getList(){
					var that=this;
					ajaxFun("GET","/trade/user/coupons",{
	                       token:this.token

	                    },function(data){
	                    	if(data.error==0){
                             
                              for(var i=0;i<data.coupons.length;i++){
                              	  data.coupons[i].str=that.getfinish_time(data.coupons[i].coupon.finish_time);
                              }
                               that.list=data.coupons;

	                    	}else{

	                    	}
	                     
                    }); 
				},

			}
		});
</script>	
</body>
</html>